package steuerung;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class Config {
	public static int laengezufallzug = 4;
	public static String server = "localhost";
	public static int serverport= 1436;
	public static int zugspeed = 20;
	public static String simu = "on";
	public static String zugname = "ABL_ZUG";
	public static int distToRichtung= 3000;
	public static int anzahlTrennerImpulse= 6;
	public static int pauseTrennerImpuls= 100;
	public static long startzeit;

	public static void loadConfig()
	{
		Properties p = new Properties();
		try {
			p.load(new FileInputStream("ablauf.ini"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		Config.laengezufallzug = Integer.parseInt(p.getProperty("LengthRandomTrain"));
		Config.server = p.getProperty("ServerName");
		Config.simu = p.getProperty("Simulator");
		Config.zugname = p.getProperty("LokName");
		Config.serverport = Integer.parseInt(p.getProperty("ServerPort"));
		Config.zugspeed = Integer.parseInt(p.getProperty("SpeedTrain"));
		Config.distToRichtung = Integer.parseInt(p.getProperty("distToRichtung"));
		Config.anzahlTrennerImpulse = Integer.parseInt(p.getProperty("TrennerImpulse"));
		Config.pauseTrennerImpuls = Integer.parseInt(p.getProperty("PauseTrennerImpulse"));
		System.out.println("zugspeed: " +Config.zugspeed);
		
		System.out.println(p.toString());
	}
}
